const express = require("express");
const app = express();
const path = require("path");

app.set("view engine", "ejs");
app.set("views", path.join(__dirname, "templates"));

// 设置 static 文件夹作为静态资源目录
app.use("/static", express.static(path.join(__dirname, "static")));

app.get("/", (req, res) => {
  res.render("junview", {
    headerImage: "/static/images/bg2.png",
    headerTag: "home",
  });
});
app.get("/service", (req, res) => {
  res.render("service", {
    headerImage: "/static/images/service-bg.jpg",
    headerTag: "service",
  });
});
app.get("/about", (req, res) => {
  res.render("about", {
    headerImage: "/static/images/about-bg.jpg",
    headerTag: "about",
  });
});
app.get("/contact", (req, res) => {
  res.render("contact", {
    headerImage: "/static/images/contact-bg.jpg",
    headerTag: "contact",
  });
});

app.listen(3000, () => {
  console.log("Server running at http://localhost:3000");
});
